import Vue from 'vue'

/**
 * 地址管理
 */

export default {
  /**
   *  获取地址列表（带分页）
   *
   * @param {*} params
   * @param {*} [config={}]
   * @returns
   */
  async getUserAddressList(params, config = {}) {
    config.params = params;
    let result = await Vue.http.get('/UserAddress/GetUserAddressList', config);
    return result;
  },
  /**
   * 更改地址
   *
   * @param {*} params
   * @param {*} [config={}]
   * @returns
   */
  async updateUserAddress(params, config = {}) {
    let result = await Vue.http.put('/UserAddress/UpdUserAddress', params, config);
    return result;
  },
  /**
   * 添加地址
   *
   * @param {*} params
   * @param {*} [config={}]
   * @returns
   */
  async addUserAddress(params, config = {}) {
    let result = await Vue.http.post('/UserAddress/AddUserAddress', params, config);
    return result;
  },
  /**
   * 删除地址
   *
   * @param {*} params
   * @param {*} [config={}]
   * @returns
   */
  async deleteUserAddress(params, config = {}) {
    config.params = params;
    let result = await Vue.http.delete('/UserAddress/DeleteAddressByID', config);
    return result;
  }
}
